﻿<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false"  CodeBehind="Item5.aspx.cs" Inherits="MaluJg.web.ProjectFund.Item5" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
        <link href="../Style/css/project.css" rel="stylesheet" type="text/css" />

     <script type="text/javascript" src="../Scripts/jquery.js"></script>
    <script src="../Scripts/uploadify/swfobject.js" type="text/javascript"></script>
    <script src="../Scripts/uploadify/jquery.uploadify.js" type="text/javascript"></script>
    <script>
        $(document).ready(function() {
            initAtt();
            $('#file_upload').uploadify({
                'width': 50,
                'height': 18,
                'uploader': '../Scripts/uploadify/uploadify.swf',
                'script': '../Common/UploadFile.ashx',
                'cancelImg': '../Scripts/uploadify/cancel.png',
                'folder': '/uploads',
                'auto': true,
                'multi': true,
                'simUploadLimit': 5,
                'buttonImg': '../Images/Upload.gif',
                'method': 'post',

                'onComplete': function(event, ID, fileObj, response, data) {

                    $("#ulAtt").append("<li id=\"" + response + "\" ><a target=\"_blank\" href=\"../common/GetAttach.aspx?id=" + response + "\">" + fileObj.name + "</a>&nbsp;&nbsp;<span  onclick=\"delAtt(this)\">[删除]</span></li>");
                    $("#ulAtt > li").each(function() {
                        $(this).attr("title", $(this).children(0).html());
                    }
                    );
                },
                'onError': function(event, queueID, fileObj) {
                    alert("文件:" + fileObj.name + " 上传失败");
                }
            });
        });
        function delAtt(obj) {
            $(obj).parent().remove();
        }
        function initAtt() {
            $("#ulAtt").html("");
            $("#ulAtt").append($("#tbAttaches").val());
            $("#ulAtt > li").each(function() {
                $(this).attr("title", $(this).children(0).html());
            });

        }
        function checkform() {            
            var ids = '';
            $("#ulAtt >li").each(function() {

                ids += "," + $(this).attr("id");
            }); if (ids != '')
                ids = ids.substring(1, ids.length);

            $("#tbAttachIDs").val(ids);
            return true;

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" style="display:none" OnClientClick="return checkform()" Text="保存"></asp:Button>
   <table border="0" cellpadding="0" cellspacing="0" id="Right" width="100%">
        <tr>
            <td id="RightTitle">
                <span>
                   项目评委小组</span>
            </td>
        </tr>
        <tr>
            <td>
                <table border="0" align="center" cellpadding="0" cellspacing="0" id="RightBox">
                    <tr>
                        <td class="rightmenu">
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                
                                <tr class="formcontentlist">
                                    <td height="25" align="left" valign="top" class="padleft5px">
                                        上传附件：
                                    </td>
                                    <td height="28">
                                        <table>
                                            <tr>
                                                <td align="left" valign="top" width="100">
                                                    <input id="file_upload" name="file_upload" type="file" />
                                                </td>
                                                <td align="left">
                                                    <ul id="ulAtt" class="ulAtt">
                                                    </ul>
                                                </td>
                                            </tr>
                                        </table>
                                        
                                        <asp:TextBox runat="server"  ID="tbAttachIDs" style="display:none"></asp:TextBox>
                                           <asp:TextBox runat="server" ID="tbAttaches" style="display:none"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
